package com.fr.chart;

import com.fr.base.StringUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.painter.AbstractPainter;
import com.fr.util.Utils;

public abstract class ChartLayout extends AbstractPainter
{
  private static final long serialVersionUID = -3903716633428879679L;
  protected int selectedIndex;
  protected int columns;

  public void setSelectedIndex(int paramInt)
  {
    this.selectedIndex = paramInt;
  }

  public int getSelectedIndex()
  {
    return this.selectedIndex;
  }

  public void setColumns(int paramInt)
  {
    this.columns = paramInt;
  }

  public int getColumns()
  {
    return this.columns;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if ((paramXMLableReader.isChildNode()) && ("LayoutAttr".equals(paramXMLableReader.getTagName())))
    {
      String str = paramXMLableReader.getAttr("selectedIndex");
      if (StringUtils.isNotBlank(str))
        setSelectedIndex(Utils.string2Number(str).intValue());
      str = paramXMLableReader.getAttr("columns");
      if (StringUtils.isNotBlank(str))
        setColumns(Utils.string2Number(str).intValue());
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("LayoutAttr").attr("selectedIndex", this.selectedIndex).attr("columns", this.columns).end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof ChartLayout))
      return false;
    ChartLayout localChartLayout = (ChartLayout)paramObject;
    if (localChartLayout.columns != this.columns)
      return false;
    return (localChartLayout.selectedIndex == this.selectedIndex);
  }
}